<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>欢迎页</title>
<style>
.public_table tr td{
	width:100px;
	text-align:center;
}
.public_table tr td img{
	width:100px;
	height:100px;
}
.public_table .table_head td{
	background:lightblue;
}
</style>
</head>
<body>
<jsp:useBean id="business" class="com.model.Business" scope="session"></jsp:useBean>
<jsp:setProperty property="*" name="business"/>
<jsp:useBean id="consumer" class="com.model.Consumer" scope="session"></jsp:useBean>
<jsp:setProperty property="*" name="consumer"/>
<h3>
<c:if test="${business.getBusinessName()!=null}">
   	<c:out value="${business.getBusinessName()}"/>
</c:if>
<c:if test="${consumer.getConsumerName()!=null}">
   	<c:out value="${consumer.getConsumerName()}"/>
</c:if>,欢迎</h3>

<c:if test="${business.getBusinessName()!=null&&consumer.getConsumerName()==null}">
	
	<form action="doManager" method="post">
		<input type="text" style="display:none" value="${business.getBusinessId()}" name="businessId">
		<input type="submit" value="查看我发布的商品">
	</form>
</c:if>
<table border="1" class="public_table">
	<tr class="table_head">
		<td>序号</td><td>名称</td><td>样图</td><td>价格</td><td>种类</td><td>详情</td><td>加入购物车</td>
	</tr>
	<c:forEach items="${goodsList}"  var="goodsItem"  varStatus="goodsStatus">
		<tr>
			<td>${goodsStatus.count}</td>
			<td>${goodsItem.getGoodsName()}</td>
			<td><img src="${goodsItem.getGoodsImg()}"/></td>
			<td>${goodsItem.getGoodsPrice()}元</td>
			<td>${goodsItem.getGoodsType()}</td>
			<td>${goodsItem.getDesc()}</td>
			<td>
				<form action="addCart" method="post">
					<input value="${goodsItem.getGoodsId()}" type="text" name="goodsId" style="display:none">
					<input value="${consumer.getConsumerId()}" type="text" name="consumerId" style="display:none">
					<input value="加入购物车" type="submit">
				</form>
			</td>
		</tr>
	</c:forEach>
</table>
</body>
</html>